A related-art heat exchanger includes a main heat exchange unit including a plurality of first heat transfer pipes arranged side by side, a sub-heat exchange unit including a plurality of second heat transfer pipes arranged side by side, and a relay unit including a plurality of relay passages connecting the plurality of first heat transfer pipes and the plurality of second heat transfer pipes. The relay passages have inlets connected to the second heat transfer pipes, and outlets connected to the first heat transfer pipes. When the heat exchanger acts as an evaporator, refrigerant flows into the first heat transfer pipes from the second heat transfer pipes through the relay passages. When the heat exchanger acts as a condenser, the refrigerant flows into the second heat transfer pipes from the first heat transfer pipes through the relay passages (for example, see Patent Literature 1).